import abc
from typing import Generic, TypeVar

AnyKey = TypeVar("AnyKey")
AnyQuery = TypeVar("AnyQuery")
AnyMatch = TypeVar("AnyMatch")


class NotMatched(Exception):
    pass


class Matcher(Generic[AnyQuery, AnyKey, AnyMatch], abc.ABC):
    @abc.abstractmethod
    def match(self, query: AnyQuery, key: AnyKey) -> AnyMatch:
        pass
